<?php

namespace app\common\model;

use think\Model;

class GoodsType extends Model
{

    //表名
    protected $name = 'goods_type';

    /**
     * @return \think\model\relation\HasMany
     * 关联商品表，该分类下的所有商品
     */
    public function goodsList()
    {
        $where = ['goods_status'=>1,'boutique_status'=>1];
        return $this->hasMany('Goods','goods_type_id','id')
                    ->field('id,goods_name,goods_type_id,total_sales')
                    ->where($where);
    }

}